import tabs from "../tabs.js"

let page = {
    after_handle_a_field: function (field, col) {
        if (field.name == "id"){
            col.label="流程号";
            col.type="tpl";
            col.tpl="${process_id}";
        }
        else if (field.name == "name") {
            col.buttons[0].onClick = (a, b) => {
                let id = b.data.id;
                let name = b.data.name;
                let process_id = b.data.process_id;
                let process_def_id = b.data.def_id;
                let diagram_task_id = b.data.diagram_task_id;
                let tab_id = "process_approve_" + id;
                let tab_label = '流程审批(' + id + ')';
                let this_property = {
                    action: "approve",
                    process_def_id: process_def_id,
                    process_id: process_id,
                    process_name: name,
                    diagram_task_id: diagram_task_id
                }
                tabs.open_by_page_type("tabs_container", tab_id, tab_label, "fa-edit", "process_approve_page_type", this_property);
            }
        }
    }
};

export default page;